package trivera.core.collections;

import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;

import static java.lang.System.*;
import static java.lang.Math.PI;

/**
 * <p>
 * This component and its source code representation are copyright protected
 * and proprietary to The Trivera Group, Inc., Worldwide D/B/A Trivera Technologies
 *
 * This component and source code may be used for instructional and
 * evaluation purposes only. No part of this component or its source code
 * may be sold, transferred, or publicly posted, nor may it be used in a
 * commercial or production environment, without the express written consent
 * of the Trivera Group, Inc.
 *
 * Copyright c 2013 The Trivera Group, LLC.
 * http://www.triveratech.com   http://www.triveragroup.com
 * </p>
 * @author The Trivera Group Tech Team.
 */

class StateInfo
{
	StateInfo (String k, String n, int p, String m)
	{abbr = k; name = n; pop = p; motto = m;}
	String abbr;
	String name;
	int pop;
	String motto;
}

enum Meal {BREAKFAST, LUNCH, DINNER};


public class HashMapTest {

	public static void varargs (String... args)
	{
		for (String item : args)
			System.out.println (item);
	}
	public static void varargs (String args)
	{
		
	}
	
	/**
	 * 
	 * @param meal bkfst = 0 , lunch = 1
	 */
	public static void eat (Meal meal)
	{
		
	}
	
	    public static void main(java.lang.String[] args) {

    	eat (Meal.LUNCH);
    	
    	varargs (new String[] {"hello", "world"});
    	varargs ("hello", "world", "bye");
    	varargs ("one string");
    	varargs();
    	
    	out.println();
    	gc();
    	
    	
    	List<Integer> li = new LinkedList();
    	int item = 20;
    	
    	li.add(item);
    	li.add(new Integer(item));

    	item = li.get(0).intValue();
    	item = li.get(0);
    	
    	for (int i=0; i< 1000000; i++)
    	{
    		li.add(i);
    	}
    	
    	
    	
        Map<String, String> myTable = new HashMap<String, String>();

        // Add the six objects to the Map.

        myTable.put("CA", "California");
        myTable.put("ID", "Idaho");
        myTable.put("NJ", "New Jersey");
        myTable.put("WA", "Washington");
        myTable.put("TX", "Texas");
        myTable.put("CO", "Colorado");

        // Extract a single value and print it

        System.out.println(myTable.get("ID") + ": Single Extraction");

        // Create sets of keys and entries.

        Set<String> keys = myTable.keySet();
        Collection<String> values = myTable.values();
        Iterator<String> keyIterator = keys.iterator();

        System.out.println("Keys:");
        while(keyIterator.hasNext()) {
            String s = keyIterator.next();
            System.out.println(s + " : " + myTable.get(s));
         }

        for (String current : keys)
        {
        	System.out.println (current);
        }
        
         Iterator<String> valueIterator = values.iterator();

         System.out.println("\n\nValues:");
         while(valueIterator.hasNext()) {
             System.out.println(item);
          }

        // verify the version of Java that is running
        System.out.println(System.getProperty("java.version"));
    }
}